#ifndef XICT_DRIVER_TASK_DRIVER_MANAGER_H
#define XICT_DRIVER_TASK_DRIVER_MANAGER_H

#include "xict_driver/param/drivers_params.h"
#include "xict_driver/task/periodic_task.h"
#include "xict_driver/utils/data_converter.h"
#include "xict_driver/utils/data_definition.h"
#include "xict_driver/utils/ecal_publisher_manager.h"
#include "xict_driver/utils/utils_common.h"
#include <memory>

namespace xict_driver {
    namespace task {
        // class xict_driver::utils::EcalPublisherManager;
        // class xict_driver::param::DriversParams;
        // class xict_driver::utils::DataConverter;

        /**
         * @brief driver manager 驱动核心管理器
         *
         */
        class DriverManager {
        public:
            typedef std::shared_ptr<DriverManager> Ptr;

            /**
             * @brief Construct a new Driver Manager object 构造函数
             *
             */
            DriverManager();

            /**
             * @brief  Initialize 初始化
             *
             * @param _driver_params
             */
            void
            Initialize(const std::shared_ptr<xict_driver::param::DriversParams>&
                           _driver_params);

            /**
             * @brief Start all tasks 启动所有任务
             *
             */
            void StartAllTasks();

            /**
             * @brief Stop all tasks 停止所有任务
             *
             */
            void StopAllTasks();

        private:
            /**
             * @brief 发布图像数据
             *
             * @param _task_name
             * @param _camera_data
             */
            void PublishCameraData(const std::string& _task_name,
                                   const cv::Mat& _camera_data);

        private:
            /// @brief 任务管理器
            xict_driver::task::PeriodicTaskManager task_manager_;
            /// @brief 数据转换器
            std::shared_ptr<xict_driver::utils::DataConverter> data_converter_;

            /// @brief 所有任务
            std::vector<std::shared_ptr<xict_driver::task::PeriodicTask>>
                tasks_;
            /// @brief eCAL 发布管理器
            std::shared_ptr<xict_driver::utils::EcalPublisherManager>
                ecal_publisher_manager_;
        };
    }   // namespace task
}   // namespace xict_driver

#endif